package com.i2863.shiroDemo.fileupload;

import com.baidu.ueditor.define.AppInfo;
import com.baidu.ueditor.define.BaseState;
import com.baidu.ueditor.define.State;
import com.baidu.ueditor.upload.ProxyStorageManager;
import com.i2863.shiroDemo.web.BaseController;

import java.io.InputStream;

/**
 * @author cexy
 * @date 2021/5/17 10:49
 * @description  ueditor富文本重写文件上传路径
 **/
public class MyTest extends BaseController implements ProxyStorageManager{
    @Override
    public State saveBinaryFile(byte[] data, String path) {

        try {
            return Upload2Qiniu.upload(data, path,127);
        } catch (Exception e) {
            return new BaseState(false, AppInfo.IO_ERROR);
        }
    }

    @Override
    public State saveFileByInputStream(InputStream is, String path, long maxSize) {
        try {
            return Upload2Qiniu.upload(is, path, maxSize,127);
        } catch (Exception e) {
            return new BaseState(false, AppInfo.IO_ERROR);
        }
    }

    @Override
    public State saveFileByInputStream(InputStream is, String path) {
        return null;
    }

}
